/** @file         ../../src/bit.c
 *  @brief        简要说明
 *  @details      详细说明
 *  @author       Schips
 *  @date         2020-10-31 18:31:33
 *  @version      v1.0
 *  @copyright    Copyright By Schips, All Rights Reserved
 *
 **********************************************************
 *
 *  @attention    NOTE
 *                SDK: 
 *                ENV: 
 *  @par 修改日志:
 *  <table>
 *  <tr><th>Date       <th>Version   <th>Author    <th>Description
 *  <tr><td>2020-10-31 <td>1.0       <td>Schips    <td>创建初始版本
 *  </table>
 *
 **********************************************************
 */

#include <stdio.h>


int Division(int y, int x)
{
	int sum=0; 
	int i=0;
	while( y > x) //向左移位直到 x >= y
	{
		x = x << 1;
		i++;      //记录左移的次数
	}

	x = x>> 1;    // 使 x <= y
	i--;

	while(i >= 0)
	{
		if(y >= x)
		{
			sum += 1 << i;
			y -= x;
		}
		x = x >> 1;
		--i;
	}

	return sum;
}
